package com.me.experiment;

import java.util.ArrayList;

import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

/*
 * AndroidGraphics.java
 * added public void drawPixmap(Pixmap pixmap, int x, int y, int w, int h)
 * 
 * 
 * 
 */


public class GraphicManager {
	
	Scene scene_;

	OrthographicCamera cam_;
	
	
	
	ArrayList<Pixmap> pixmaps_;
	public ArrayList<Object> objects_; // array of objects where objects are sorted by display order
	
	public GraphicManager(Scene s) {
		scene_ = s;
		pixmaps_ = new ArrayList<Pixmap>();
		objects_ = null;
	}
	
	public Pixmap addPixmap(String img) {
	//	pixmaps_.add(graphics_.newPixmap(img, PixmapFormat.ARGB4444));
		return pixmaps_.get(pixmaps_.size()-1);
	}
	
	public void sortObjects() {
		objects_ = null;
		objects_ = new ArrayList<Object>(scene_.objects_.size());
		for(Object o: scene_.objects_) objects_.add(o);
		//scene_.sortObjectPerDepth(objects_, -1);
	}

	public void drawObjects(float t,SpriteBatch batch) {
		for (Object o : objects_) {
			if (o.visible_) {	o.draw(batch);}	
		}	
	}
	
	public void addObject(Object o) {
		objects_.add(o);
	}
	
	
	
}
